package com.fac.controller.user;

import com.fac.dto.EquipmentAvailableQueryDTO;
import com.fac.result.PageResult;
import com.fac.result.Result;
import com.fac.service.EquipmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户端设备控制器
 */
@RestController("userEquipmentController")  // 区分管理端的Controller
@RequestMapping("/user/equipment")
@Api(tags = "用户端-设备相关接口")
@Slf4j
public class EquipmentController {

    @Autowired
    private EquipmentService equipmentService;

    /**
     * 查询可租赁设备列表
     *
     * @param queryDTO 查询条件
     * @return 可租赁设备列表
     */
    @GetMapping("/available")
    @ApiOperation("查询可租赁设备列表")
    public Result<PageResult> listAvailable(EquipmentAvailableQueryDTO queryDTO) {
        log.info("查询可租赁设备列表：{}", queryDTO);
        PageResult pageResult = equipmentService.listAvailable(queryDTO);
        return Result.success(pageResult);
    }
} 